<template>
	<div>
		<div>
			<el-table :data="data" v-loading="loading" :max-height="tableHeight" highlight-current-row style="width: 100%;height:255px;">
				<el-table-column prop="Title" label="名称" width="180" show-overflow-tooltip>
					<template slot-scope="scope">
						<div @click="seedetail(scope.row)">{{ scope.row.Title }}</div>
					</template>
				</el-table-column>
				<el-table-column prop="ClubName" label="学生组织" width="150" show-overflow-tooltip>
					<template slot-scope="scope">
						{{ scope.row.ClubName||scope.row.ClassName }}
					</template>
				</el-table-column>
				<el-table-column label="操作" width="70">
					<template slot-scope="scope">
						<a-dropdown placement="bottomRight">
							<a-menu slot="overlay">
								<a-menu-item key="2" v-if="(new Date().getTime() < new Date(scope.row.EndTime.replace(/-/g, '/')).getTime())&&scope.row.State != 5" @click="AllJoinActivity(scope.row)" >加入活动</a-menu-item>
							</a-menu>
							<a-button shape="circle" class="titlemore"><a-icon type="more" /></a-button>
						</a-dropdown>
					</template>
				</el-table-column>
			</el-table>
			<a-tabs default-active-key="1" @change="tabChange">
			      <a-tab-pane key="1" tab="进行中">
			      </a-tab-pane>
			      <a-tab-pane key="2" tab="待完结">
			      </a-tab-pane>
			      <a-tab-pane key="3" tab="已完结">
			      </a-tab-pane>
			    </a-tabs>
		</div>
	</div>
</template>

<script>
import moment from 'moment';
import Func from '@/utils/func';
import { UserGetListActivityIndex } from '@/api/follow';
const data = []
export default {
	props:{
		currentID:String
	},
	watch:{
		currentID: function(currentID) {
			this.nowcurrentID = currentID
			this.getList()
		}
	},
	components: {},
	data() {
		return {
			applyIf: false,
			data,
			addIf: false,
			text: {},
			loading: false,
			values: {},
			tableHeight: parseFloat(window.innerHeight - 160),
			nowcurrentID:'',
			state:1
		};
	},
	computed: {},
	created() {
	},
	mounted() {},
	methods: {
		moment,
		tabChange(key) {
			this.state = key;
			this.getList()
		},
		async getList() {
			this.loading = true;
			let data = {};
			if (this.values) {
				data = this.values;
			}
			data.state = this.state;
			data.top = 5;
			data.typeID = this.nowcurrentID
			let res = await UserGetListActivityIndex(data);
			this.loading = false;
			this.data = res.data.data;
		},
		seedetail(data){
			this.$emit('seedetail',data)
		},
		AllJoinActivity(data){
			this.$emit('AllJoinActivity',data)
		},
		closeFun() {
			this.getList();
		}
	}
};
</script>

<style lang="less" scoped>
.home-form /deep/.ant-form-item {
	display: flex;
	margin-bottom: 10px !important;
}
.home-form /deep/.ant-form-item-label {
	width: 80px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	text-align: right;
}
.home-form /deep/.ant-form-item-control-wrapper {
	flex: 1;
}
/deep/.el-table th.is-leaf {
	background: #fff!important;
}
.option {
	margin-top: 10px;
	margin-bottom: 20px;
	overflow: hidden;
}
.option .btn {
	height: 36px;
	line-height: 36px;
	padding: 0 10px;
	float: left;
	background: #1890ff;
	color: #fff;
	margin-right: 10px;
	border-radius: 3px;
	cursor: pointer;
	border: none;
}
.foot {
	text-align: center;
	margin-top: 100px;
}
.el-pagination {
	margin-top: 10px;
}
/deep/.ant-tabs-bar{
	margin:0px auto 0;
	border-bottom:none;
}
/deep/.ant-tabs-nav .ant-tabs-tab{
	padding:4px 6px;
}
.titlemore {
		min-width:24px;
    width: 24px;
    height: 24px;
		line-height:24px;
}
</style>
